Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add relevant chunks prompts #745

Merged
merged 2 commits into from
Sep 15, 2024
Merged

Conversation

Pouyanpi
Copy link
Collaborator

Add relevant chunks for generate_flow_continuation and generate_user_intent_and_bot_action_from_user_action tasks

tested with abc_v2 config (also for meta/llama3-70b-instruct) without kb folder.

from nemoguardrails import LLMRails, RailsConfig

config = RailsConfig.from_path("./examples/bots/abc_v2")
rails = LLMRails(config)

response = rails.generate(messages=[{
    "role": "context",
    "content": {
        "relevant_chunks": """
            Employees are eligible for the following time off:
              * Vacation: 15 days per year, accrued monthly.
              * Sick leave: 25 days per year, accrued monthly.
              * Personal days: 5 days per year, accrued monthly.
              * Paid holidays: New Year's Day, Memorial Day, Independence Day, Thanksgiving Day, Christmas Day.
              * Bereavement leave: 3 days paid leave for immediate family members, 1 day for non-immediate family members. """
    }
},{
    "role": "user",
   
    "content": "How many sick leaves do employees have?"
}])

response["content"] must contain 25 days.

…d 'generate_user_intent_and_bot_action_from_user_action' tasks
Copy link
Collaborator

@drazvan drazvan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pouyanpi: moved the relevent chunks up a bit in a couple of templates. The idea is to not break the pattern from the current conversation, so that in-context learning will kick in to keep the right format.

@drazvan drazvan merged commit 0287fbe into develop Sep 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants